import axios from "axios"
import $http from "./header"

const request = class {
    constructor(url, args) {
        this.url = url
        this.args = args
    }
    // post请求
    modePost() {
        return new Promise((resolve, reject)=> {
            $http.post((this.url), this.args)
            .then(res=> {
                resolve(res)
            })
            .catch(err => {
                reject(err)
            })
        })
    }

    // get 请求
    modeGet() {
        return new Promise((resolve, reject)=> {
            $http.get((this.url))
            .then(res=> {
                resolve(res)
            })
            .catch(err => {
                reject(err)
            })
        })
    }
}
export default request
